package com.zxq.frame;

import com.zxq.factory.annotate.DecoderField;
import com.zxq.factory.annotate.EncoderField;
import com.zxq.factory.annotate.Frame;
import com.zxq.factory.enums.EField;
import com.zxq.factory.enums.ETrimMethod;
import lombok.Data;

@Frame(id = 5L,remark = "IEC104协议")
@Data
public class IEC104Frame {

    @DecoderField(sequence = 1,field = EField.Hex)
    @EncoderField(sequence = 1,field = EField.Hex)
    String magic;

    @DecoderField(sequence = 2,field = EField.Hex)
    @EncoderField(sequence = 2,field = EField.Hex)
    String version;

    @DecoderField(sequence = 3,field = EField.Int,param = 1)
    @EncoderField(sequence = 3,field = EField.Int,len = 1)
    Integer opcode;

    @DecoderField(sequence = 4)
    @EncoderField(sequence = 4)
    Integer len;

    @DecoderField(sequence = 5,field = EField.Bytes,method = ETrimMethod.Tail)
    @EncoderField(sequence = 5,field = EField.Bytes)
    byte[] dataFrame;

    @DecoderField(sequence = 6,field = EField.Hex)
    @EncoderField(sequence = 6,field = EField.Hex)
    String crc16;



}

